<template>
  <div ref="editorContainer"></div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
import { EditorView } from '@codemirror/view';
import { basicSetup } from 'codemirror';
import { javascript } from '@codemirror/lang-javascript';
const editorContainer = ref(null);
onMounted(() => {
  new EditorView({
    doc: 'console.log("Hello, World!");',
    extensions: [basicSetup, javascript()],
    parent: editorContainer.value
  });
});
</script>
<style>
  /* 引入CodeMirror的基本样式 */
  @import "codemirror/lib/codemirror.css";
</style>